package com.surfacing.rcp.client.controller;


import org.apache.log4j.Logger;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchWindow;

import com.surfacing.rcp.client.modelManager.SessionManager;

/**
 * This action brings up the connection wizard to reconnect and login to a
 * server
 * 
 * @author Michael
 */
public class LogoutAction extends Action {
	// properties
	private final IWorkbenchWindow window;
	private static final Logger log = Logger.getLogger(LogoutAction.class);
	public final static String ID = "com.surfacing.rcp.client.logOut";

	/**
	 * Default class constructor.
	 * 
	 * @param viewer
	 *            the table viewer
	 */
	public LogoutAction(IWorkbenchWindow window) {
		this.window = window;
		setText("Logout");
		setToolTipText("Vom System abmelden!");
	}

	@Override
	public void run() {
		log.info("Logout NEF-Journal!");
		SessionManager.getInstance().fireLogout();
		window.getWorkbench().restart();
	}

	@Override
	public String getId() {
		return ID;
	}
}